package keye.document_manage.gui;

import javax.swing.table.DefaultTableModel;

public class MyTableModel extends DefaultTableModel {

	private static final long serialVersionUID = 1L;

	
//	private String[] columnNames = {"First Name",
//			"Favorite Color",
//			"Sport",
//			"# of Years",
//	"Vegetarian2"};
//	private Object[][] data = {
//			{new Boolean(false), new Color(153, 0, 153),
//				"Snowboarding", new Integer(5), new Boolean(false)},
//
//	};
//
//	public int getColumnCount() {
//		return columnNames.length;
//	}
//
//	public int getRowCount() {
//		return data.length;
//	}
//
//	public String getColumnName(int col) {
//		return columnNames[col];
//	}
//
//	public Object getValueAt(int row, int col) {
//		return data[row][col];
//	}

	public MyTableModel() {
		// TODO Auto-generated constructor stub
	}
	public MyTableModel(Object[] objects, int i) {
		super(objects, i);
	}

	/*
	 * JTable uses this method to determine the default renderer/
	 * editor for each cell.  If we didn't implement this method,
	 * then the last column would contain text ("true"/"false"),
	 * rather than a check box.
	 */
	@Override
	public Class<?> getColumnClass(int c) {
//		System.out.println("c:"+c);
		Object obj = getValueAt(0, c);
		return obj==null?Object.class:obj.getClass();
	}

	@Override
	public Object getValueAt(int row, int column) {
//		System.out.println("getValueAt  column:"+column+"  row:"+row);
		return super.getValueAt(row, column);
	}
	
	@Override
	public boolean isCellEditable(int row, int column) {
//		System.out.println("row:"+row);
		if(row ==0)
			return true;
	    return false;//不能编辑
	}
	
	

}
